<?php

class AjaxController extends Controller
{

  public $masterPage = 'Default';

  public function IndexAction()
  {
    System::Web()->ScriptManager->js('calculator','/javascript/calculator.js');

    $model = str_replace('?WSDL','/Calculation',System::ConfigManager()->WebService['wsdl']);

    return $this->View('index')
                ->Model($model)
                ->Render();
  }


  public function UserAction($id)
  {
    // Test model
    $user = new User();
    $user->id = $id;
    $user->guid = uniqid();
    $user->email = 'r.metlinskyi@gmail.com';
    $user->firstName = 'Roman';
    $user->lastName = 'Metlinskyi';
    $user->password = 'qwerty';

    return $this->View()
                ->Model($user)
                ->ToJson();
  }
}